package gold.digger;

import gold.utils.InputUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by fanzhenyu02 on 2020/6/27.
 * common problem solver template.
 */
public class LC848 {
    public long startExecuteTime = System.currentTimeMillis();


    class Solution {
        public String shiftingLetters(String s, int[] shifts) {
            StringBuilder res = new StringBuilder();
            int curShift = 0;
            for (int i = shifts.length - 1; i >= 0; i--) {
                curShift = (curShift + shifts[i]) % 26;
                char curChar = (char) ((s.charAt(i) - 'a' + curShift) % 26 + 'a');
                res.insert(0, curChar);
            }

            return res.toString();
        }
    }

    public void run() {
        Solution solution = new Solution();
        int[] arr = InputUtil.toIntegerArray("[3,5,9]");
        System.out.println(solution.shiftingLetters("abc", arr));
    }

    public static void main(String[] args) throws Exception {
        LC848 an = new LC848();
        an.run();

        System.out.println("\ncurrent solution total execute time: " + (System.currentTimeMillis() - an.startExecuteTime) + " ms.");
    }
}
